function print_r(aObj,offset) {
	if (typeof(aObj)!='object') return aObj;
	if (!offset) offset='';
	var out='';
	for (var i in aObj) {
		if (typeof(aObj[i])=='object') out+=offset+i+'\r\n'+print_r(aObj[i],offset+'  ');
		else if (typeof(aObj[i])=='function') out+=offset+i+' - function\r\n';
		else out+=offset+i+' - '+aObj[i]+'\r\n';
	}
	if (offset=='') return alert(out); else return out;
}

function win(url,awidth,aheight,wnd,no_scroll) {
	var scroll = (no_scroll) ? 'no':'yes';
	var x=(self.screen.width-awidth)/2; if (x<0) x=0;
	var y=(self.screen.height-aheight)/2; if (y<0) y=0;
	window.open(url,wnd,"width=" + awidth + ", height=" + aheight + ", replace=no, scrollbars=" + scroll + ", resize=no, left="+ x +", top=" + y);
}

function set_now(id,ts) {
	var elm=document.getElementById(id); if (!elm || elm.value!='') return;
	var dt=new Date();
	var vl='', s=0;
	s=dt.getDate(); if (s<10) vl+='0'+s+'.'; else vl+=s+'.';
	s=dt.getMonth()+1; if (s<10) vl+='0'+s+'.'; else vl+=s+'.';
	vl+=dt.getFullYear();
	
	if(ts){
		vl+=' ';
		s=dt.getHours(); if(s<10) vl+='0'+s+':'; else vl+=s+':';
		s=dt.getMinutes(); if(s<10) vl+='0'+s+':'; else vl+=s+':';
		s=dt.getSeconds(); if(s<10) vl+='0'+s; else vl+=s;
	}
	elm.value=vl;
}